import { Component } from 'react'

class App extends Component {
  // 1. 定义类组件状态（vue中data数据）
  state = {
    count: 0,
    obj: {
      name: '鑫柯',
      age: 18
    },
    list: [1, 2, 3]
  }

  render() {
    console.log('组件实例：', this)
    return (
      <div>
        <h1>类组件状态</h1>
        <hr />
        <ul>
          {/* 2. 获取状态 */}
          <li>{this.state.count}</li>
          <li>
            名字：{this.state.obj.name}-年龄{this.state.obj.age}
          </li>
          <li></li>
          <li></li>
          <li></li>
          <li></li>
        </ul>
        <hr />
        <ul>
          {this.state.list.map(item => (
            <li key={item}>{item}</li>
          ))}
        </ul>
      </div>
    )
  }
}
export default App
